import { ApiProperty } from "@nestjs/swagger";
import { IsNotEmpty, IsString } from "class-validator";
import { UserRole } from "../entities/user.entity";

export class CreateUserDto {
	@ApiProperty({ description: "用户名" })
	@IsNotEmpty({ message: "用户名必填" })
	@IsString({ message: "account是字符串" })
	readonly account: string;

	@ApiProperty({ description: "昵称" })
	@IsString({ message: "nickname是字符串" })
	readonly nickname: string;

	@ApiProperty({ description: "密码" })
	@IsNotEmpty({ message: "密码必填" })
	@IsString({ message: "password是字符串" })
	readonly password: string;

	@ApiProperty({ description: "头像" })
	@IsString({ message: "avatar是字符串" })
	readonly avatar: string = "";

	@ApiProperty({ description: "邮箱" })
	@IsString({ message: "email是字符串" })
	readonly email: string = "";

	@ApiProperty({ description: "用户角色" })
	@IsString({ message: "role是字符串" })
	readonly role: UserRole = UserRole.visitor;
}
